package org.example.coupon.controller.front;

import org.example.core.utils.R;
import org.example.coupon.service.CouponHistoryService;
import org.example.coupon.to.CouponTo;
import org.example.coupon.vo.CouponVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;


/**
 * @author xiaojie_cc
 * @version 1.0
 */
@RestController
@RequestMapping("/sms/front/cHistory")
public class CouponHistoryFrontController {
    @Autowired
    private CouponHistoryService couponHistoryService;

    /**
     * 订单页需要的优惠卷信息
     */
    @GetMapping("/cMember")
    public R<?> couponMember(){
        List<CouponTo> couponVos = couponHistoryService.queryCouponMember();
        return R.ok(couponVos);
    }

    @GetMapping("/{couponId}")
    public R<CouponVo> queryCoupon(@PathVariable Long couponId){
        CouponVo couponVo = couponHistoryService.queryCouponIsUsed(couponId);
        return R.ok(couponVo);
    }
}
